package com.duke.shaking.utils.pay;

import java.util.HashMap;
import java.util.Map;

/**
 * 展示购买商品信息列表
 *
 */

public class Products {
	
	private static Map<Integer, ProductDetail> productMap;

	private static ProductDetail createProduct(String name, String desc, 
			float price, int coins, int payId) {
		ProductDetail productDetail = null;
		productDetail = new ProductDetail();
		productDetail.payID = String.valueOf(payId);
		productDetail.price = String.valueOf(price);
		productDetail.payName = name;
		productDetail.body = desc;
		productDetail.coins = coins;
		return productDetail;
	}
	
	private static Map<Integer, ProductDetail> getProductMap() {
		
		if (productMap != null) {
			return productMap;
		}
		productMap = new HashMap<Integer, ProductDetail>();
		
		ProductDetail productDetail = null;
		
		//
		productDetail = createProduct("", "", 6, 60, 1);
		productMap.put(1, productDetail);
		
		productDetail = createProduct("", "", 30, 300, 2);
		productMap.put(2, productDetail);
		
		productDetail = createProduct("", "", 93, 930, 3);
		productMap.put(3, productDetail);
		
		productDetail = createProduct("", "", 188, 1880, 4);
		productMap.put(4, productDetail);
		
		productDetail = createProduct("", "", 388, 3880, 5);
		productMap.put(5, productDetail);
		
		return productMap;
	}
	
	public static ProductDetail getProductDetail(int productType) {
		Map<Integer, ProductDetail> pm = getProductMap();
		return pm.get(productType);
	}
}
